<?php

// +----------------------------------------------------------------------
// | Shop-Demo for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2022~2023 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// | 会员免费 ( https://thinkadmin.top/vip-introduce )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\data\model;

use think\admin\Model;

/**
 * 新闻内容模型
 * Class DataNewsItem
 * @package app\data\model
 */
class DataQyszd extends Model
{
    protected $submitStatusArr = [
        self::SUBMIT_STATUS_ALREADY  => '已提交',
        self::SUBMIT_STATUS_AUDITING => '审核中',
        self::SUBMIT_STATUS_PUBLIC   => '已公示',
        self::SUBMIT_STATUS_REALIZED => '已落实',
    ];
    const SUBMIT_STATUS_ALREADY  = 1;
    const SUBMIT_STATUS_AUDITING = 2;
    const SUBMIT_STATUS_PUBLIC   = 3;
    const SUBMIT_STATUS_REALIZED = 4;

    const STATUS_DISABLE = 0;
    const STATUS_ENABLE  = 1;

    protected $statusArr = [
        self::STATUS_DISABLE => '禁用',
        self::STATUS_ENABLE  => '使用',
    ];

    /**
     * 格式化创建时间
     * @param  string  $value
     * @return string
     */
    public function getCreateAtAttr(string $value): string
    {
        return format_datetime($value);
    }

    /**
     * 格式化申报截止时间
     * @param $value
     * @return string
     */
    public function getSbjzrqDate($value): string
    {
        return date('Y-m-d', $value);
    }

    public function getCtrqDate($value): string
    {
        return date('Y-m-d', $value);
    }

    /**
     * 获取提交状态文字
     * @param $status
     * @return string
     */
    public function getSubmitStatusTxt($status): string
    {
        return $this->submitStatusArr[$status] ?? '-';
    }

    /**
     * 获取状态文字
     * @param $status
     * @return string
     */
    public function getStatusTxt($status): string
    {
        return $this->statusArr[$status] ?? '-';
    }

}
